import Vue from 'vue'
import VueRouter from 'vue-router'


const Home = () => import('../views/home/Home')
const Category = () => import('../views/category/Category')
const Cart = () => import('../views/cart/Cart')
const Profile = () => import('../views/profile/Profile')
const All= () => import('../components/All')
const a= () => import('../components/a')
const b= () => import('../components/b')
const c= () => import('../components/c')
const d= () => import('../components/d')
const e= () => import('../components/e')
const f= () => import('../components/f')
const Login= () => import('../components/Login')
const Register= () => import('../components/Register')
const Adress= () => import('../components/Adress')
const Newcreate= () => import('../components/Newcreate')
const Edit= () => import('../components/Edit')
// 1.安装插件
Vue.use(VueRouter)

// 2.创建路由对象
const routes = [
  {
    path: '',
    redirect: '/Login'
  },{
    path: '/Login',
    component: Login,
    meta:{
      show:true
    }
  },{
    path: '/home',
    component: Home
  },
  {
    path: '/category',
    component: Category
  },
  {
    path: '/cart',
    component: Cart
  },
  {
    path: '/profile',
    component: Profile
  },{
    path: '/Register',
    component: Register,
    meta:{
      show:true
    }
  },{
    path: '/Newcreate',
    component: Newcreate,
    meta:{
      show:true
    }
  },{
    path: '/Adress',
    component: Adress,
    meta:{
      show:true
    }
  },{
    path: '/Edit',
    component: Edit,
    meta:{
      show:true
    }
  },{
    path: '/All',
    name:'All',
    component: All,
    redirect:'a',
    meta:{
      show:true
    },
    children:
    [{
      path:"/a",
      name:"a",
      component:a,
      meta:{
        show:true
      }
    },{
      path:"/b",
      name:"b",
      component:b,
      meta:{
        show:true
      }
    },{
      path:"/c",
      name:"c",
      component:c,
      meta:{
        show:true
      }
    },{
      path:"/d",
      name:"d",
      component:d,
      meta:{
        show:true
      }
    },{
      path:"/e",
      name:"e",
      component:e,
      meta:{
        show:true
      }
    },{
      path:"/f",
      name:"f",
      component:f,
      meta:{
        show:true
      }
    }]
  }
]
const router = new VueRouter({
  routes,
  mode: 'history'
})

// 3.导出路由对象
export default router
